<extend name="Public/baseConf"/>  
<block name="breadcrumb"> 
	<div class="row wrapper border-bottom white-bg page-heading">
	    <div class="col-lg-4">
	        <h2>其它设置</h2>
	        <ol class="breadcrumb">
	            <li><a href="{:U('index/index')}">首页</a></li>
	            <li class="active">
	                <strong>其它设置</strong>
	            </li>
	        </ol>
	    </div>
	    <div class="col-lg-6"></div>
	    <div class="col-lg-2">
            <div class="title-action">
           		<button class="btn btn-primary ajax-post" type="submit" target-form="form">
           		<i class="fa fa-pencil align-top"></i>确定
           		</button> 
            </div>
        </div>
	</div> 
</block>
<block name="body">
	<div class="wrapper wrapper-content animated fadeInRight">
		<form action="{:U('save')}" method="post" class="form">
	        <div class="row">
		        <div class="col-lg-12">
		            <div class="ibox float-e-margins">
		                <div class="ibox-title">
		                    <h5>网站基本信息设置</h5>
		                    <div class="ibox-tools">
		                        <a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
		                    </div>
		                </div>
		                <div class="ibox-content">
			                    <div class="row">
			                    	<input type="hidden" name="id" value="{$data['id']}"/>
									<input type="hidden" name="logopath" id="logopath" value="{$data['logopath']}"/>
			                        <div class="col-sm-4">
										<input type="file" id="upload_picture" align='center'> 
										<input type="hidden"  name="logoicon" id="logoicon" value=""/>
										<div class="image">
											<notempty name="data['logopath']"> 
												<img class="img-responsive" src="__ROOT__{$data['logopath']}"/>
											</notempty>  
										</div>
			                        </div>
			                    </div> 
		                    </form>
		                </div>
		            </div>
		            <div class="ibox float-e-margins">
		                <div class="ibox-title">
		                    <h5>网站微信公众号设置</h5>
		                    <div class="ibox-tools">
		                        <a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
		                    </div>
		                </div>
		                <div class="ibox-content"> 
		                    <div class="row">
                                <div class="input-group">
                                    <span class="input-group-btn">
                                        <button class="btn btn-info" type="button">微信TOKEN</button>
                                    </span>
	                                <input type="text" id="apptoken" name="apptoken" value="{$data['apptoken']}" placeholder="微信公众账号TOKEN" class="form-control">
	                            </div>
                                <div class="input-group">
                                    <span class="input-group-btn">
                                        <button class="btn btn-info" type="button">微信APPID</button>
                                    </span>
	                                <input type="text" id="appid" name="appid" value="{$data['appid']}" placeholder="微信公众账号ID" class="form-control">
                                </div>
                                <div class="input-group">
                                    <span class="input-group-btn">
                                        <button class="btn btn-info" type="button">微信APPSECRET</button>
                                    </span>
	                                <input type="text" id="appsecret" name="appsecret" value="{$data['appsecret']}" placeholder="微信公众账号SECRET" class="form-control">
                                </div>
		                    </div> 
		                </div>
		            </div>
		        </div>
	        </div>
    	</form>
    </div>
</block>  
<block name="script">
	<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <script type="text/javascript"> 
	    /* 初始化上传插件 */
		$("#upload_picture").uploadify({
	        "height"          : 30,
	        "swf"             : "__STATIC__/uploadify/uploadify.swf",
	        "fileObjName"     : "download",
	        "buttonText"      : "上传网站logo",
	        "uploader"        : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
	        "width"           : 120,
	        'removeTimeout'	  : 1,
	        'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
	        "onUploadSuccess" : uploadPicture,
	        'onFallback' : function() {
	            alert('未检测到兼容版本的Flash.');
	        }
	    });
		function uploadPicture(file, data){
	    	var data = $.parseJSON(data);
	    	var src = ''; 
	        if(data.status){ 
	        	$("#logoicon").val(data.id); 
	        	src = data.url || '__ROOT__' + data.path 
	        	$("#logoicon").parent().find('.image').html( 
	        		'<img class="img-responsive" src="' + src + '"/>' 
	        	); 
	        	$("#logopath").val(data.path); 
	        } else {
	        	updateAlert(data.info);
	        	setTimeout(function(){ 
	                $(this).removeClass('disabled').prop('disabled',false);
	            },1500);
	        }
	    }
	</script>	
</block>
